<template>
    <el-tree :data="[it]" show-checkbox default-expand-all node-key="id" :ref="treeRef" highlight-current
        :props="{ children: 'children', label: 'mName' }" :default-checked-keys="checkedList"></el-tree>
</template>

<script setup>
let props = defineProps(["it", 'treeRef', 'checkedList']);
import { ref, reactive, watch, nextTick } from 'vue'
import department_role from '@/store/department_role/index.js'
let $department_role = department_role()

let off = ref(true)
const authMenuTree = ref('')

const btn = () => {
    let checkedNodeList = [];
    // for (let i = 0; i < authMenuTree.value.length; i++) {
    //     checkedNodeList = checkedNodeList.concat(checkedNodeList.value[i].getCheckedNodes());
    // }
    // authMenuTree.value.forEach(it => {
    //     con
    // })
    let data = [authMenuTree.value]
    data.forEach(it => {
        checkedNodeList = checkedNodeList.concat(it.getCheckedNodes());
    });
    $department_role.data_list = checkedNodeList
    console.log($department_role.data_list, '子')
}
watch(() => $department_role.off, () => {
    console.log(1)
    // off.value = false
    nextTick(() => {
        btn()
        // off.value = true

    })
})


</script>
